#ifndef ITEMNUMBERDIALOG_H
#define ITEMNUMBERDIALOG_H

#include <QDialog>

#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>

#include "DatabaseSearchDialog.h"
#include "Debug.h"
#include "dbms.h"

class ItemNumberDialog : public QDialog
{
    Q_OBJECT
private:
    bool ItemChoosen;
    bool NumberIsValid;

    ItemType item;
    int number;

    DBMS *dbms;
    DataBase *DB;
    DatabaseSearchDialog *SearchDialog;

    QLabel *ItemLabel;
    QLabel *NumberLabel;

    QLineEdit *ItemEdit;
    QLineEdit *NumberEdit;

    QPushButton *OkButton;
    QPushButton *CancelButton;
    QPushButton *ChooseButton;

    QHBoxLayout *ItemLayout;
    QHBoxLayout *NumberLayout;
    QHBoxLayout *ControlLayout;
    QVBoxLayout *MainLayout;

private:
    void Clear();
    void closeEvent ( QCloseEvent * event );

private slots:
    void ChoosePressed();
    void OkPressed();
    void Item( const ItemType &item );

signals:
    void Item( const ItemType& item, int count );

public:
    ItemNumberDialog( DBMS *dbms, QWidget *parent = 0 );
    ~ItemNumberDialog();
};

#endif // ITEMNUMBERDIALOG_H
